Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

katex

Package Overview
Dependencies
Maintainers
2
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

katex

Fast math typesetting for the web.

  • 0.4.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4M
increased by1.74%
Maintainers
2
Weekly downloads
 
Created

What is katex?

KaTeX is a fast, easy-to-use JavaScript library for TeX math rendering on the web. It provides a way to display mathematical notation in web pages, supporting a wide range of TeX functions and symbols.

What are katex's main functionalities?

Render TeX to HTML

This feature allows you to convert TeX expressions into HTML. The `renderToString` method takes a TeX string and returns an HTML string that can be inserted into a web page.

const katex = require('katex');
const html = katex.renderToString('c = \pm\sqrt{a^2 + b^2}');
console.log(html);

Render TeX to DOM

This feature allows you to render TeX expressions directly into a DOM element. The `render` method takes a TeX string and a DOM element, and it updates the element's content with the rendered math.

const katex = require('katex');
const element = document.getElementById('math');
katex.render('E = mc^2', element);

Auto-render TeX in HTML

This feature automatically finds and renders all TeX expressions within a given DOM element. The `renderMathInElement` function scans the element for TeX expressions and replaces them with rendered math.

const katex = require('katex');
const renderMathInElement = require('katex/contrib/auto-render');
renderMathInElement(document.body);

Other packages similar to katex

FAQs

Package last updated on 20 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc